<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        // let sex_ = "男"
        // class Han{
        //     constructor(name,age){
        //         this.name = name;
        //         this.age = age;
        //     }
        //     get sex(){
        //         return sex_;
        //     }
        //     set sex(value){
        //         sex_ = value
        //     }
        // }
        // let han = new Han("韩",25);
        // han.sex = "女"
        // console.log(han);

        let sex_ = "男";
        class Zhu{
            constructor(name,age){
                this.name = name;
                this.age = age;
            }
            get sex(){
                return sex_;
            }
            set sex(value){
                sex_ = value;
            }
        }
        let zhu = new Zhu("小王",24);
        zhu.sex = "女"
        console.log(zhu);
    </script>
</body>
</html>